# This is supposed to be a complete list of top-level directories,
# excepting only api/ itself.
include_rules = [
  "-audio",
  "-base",
  "-build",
  "-buildtools",
  "-build_overrides",
  "-call",
  "-common_audio",
  "-common_video",
  "-data",
  "-examples",
  "-ios",
  "-infra",
  "-logging",
  "-media",
  "-modules",
  "-out",
  "-p2p",
  "-pc",
  "-resources",
  "-rtc_base",
  "-rtc_tools",
  "-sdk",
  "-stats",
  "-style-guide",
  "-system_wrappers",
  "-test",
  "-testing",
  "-third_party",
  "-tools",
  "-tools_webrtc",
  "-video",
  "-external/webrtc/webrtc",  # Android platform build.
  "-libyuv",
  "-common_types.h",
  "-WebRTC",
]

specific_include_rules = {
  # Some internal headers are allowed even in API headers:
  ".*\.h": [
    "+rtc_base/checks.h",
    "+rtc_base/system/rtc_export.h",
    "+rtc_base/units/unit_base.h",
  ],

  "array_view\.h": [
    "+rtc_base/type_traits.h",
  ],

  # Needed because AudioEncoderOpus is in the wrong place for
  # backwards compatibilty reasons. See
  # https://bugs.chromium.org/p/webrtc/issues/detail?id=7847
  "audio_encoder_opus\.h": [
    "+modules/audio_coding/codecs/opus/audio_encoder_opus.h",
  ],

  "asyncresolverfactory\.h": [
    "+rtc_base/asyncresolverinterface.h",
  ],

  "candidate\.h": [
    "+rtc_base/network_constants.h",
    "+rtc_base/socketaddress.h",
  ],

  "create_peerconnection_factory\.h": [
    "+rtc_base/scoped_ref_ptr.h",
  ],

  "datachannelinterface\.h": [
    "+rtc_base/copyonwritebuffer.h",
    "+rtc_base/refcount.h",
  ],

  "dtmfsenderinterface\.h": [
    "+rtc_base/refcount.h",
  ],

  "fec_controller\.h": [
    "+modules/include/module_fec_types.h",
  ],

  "jsep\.h": [
    "+rtc_base/refcount.h",
  ],

  "jsepicecandidate\.h": [
    "+rtc_base/constructormagic.h",
  ],

  "jsepsessiondescription\.h": [
    "+rtc_base/constructormagic.h",
  ],

  "mediastreaminterface\.h": [
    "+modules/audio_processing/include/audio_processing_statistics.h",
    "+rtc_base/refcount.h",
    "+rtc_base/scoped_ref_ptr.h",
  ],

  "media_transport_interface\.h": [
    "+rtc_base/copyonwritebuffer.h",  # As used by datachannelinterface.h
    "+rtc_base/networkroute.h"
  ],

  "peerconnectionfactoryproxy\.h": [
    "+rtc_base/bind.h",
  ],

  "refcountedbase\.h": [
    "+rtc_base/constructormagic.h",
    "+rtc_base/refcount.h",
    "+rtc_base/refcounter.h",
  ],

  "rtcerror\.h": [
    "+rtc_base/logging.h",
  ],

  "rtpreceiverinterface\.h": [
    "+rtc_base/refcount.h",
    "+rtc_base/scoped_ref_ptr.h",
  ],

  "rtpsenderinterface\.h": [
    "+rtc_base/refcount.h",
    "+rtc_base/scoped_ref_ptr.h",
  ],

  "rtptransceiverinterface\.h": [
    "+rtc_base/refcount.h",
  ],

  "setremotedescriptionobserverinterface\.h": [
    "+rtc_base/refcount.h",
  ],

  "statstypes\.h": [
    "+rtc_base/constructormagic.h",
    "+rtc_base/refcount.h",
    "+rtc_base/scoped_ref_ptr.h",
    "+rtc_base/stringencode.h",
    "+rtc_base/thread_checker.h",
  ],

  "umametrics\.h": [
    "+rtc_base/refcount.h",
  ],

  "audio_frame\.h": [
    "+rtc_base/constructormagic.h",
  ],

  "audio_mixer\.h": [
    "+rtc_base/refcount.h",
  ],

  "audio_decoder\.h": [
    "+rtc_base/buffer.h",
    "+rtc_base/constructormagic.h",
  ],

  "audio_decoder_factory\.h": [
    "+rtc_base/refcount.h",
  ],

  "audio_decoder_factory_template\.h": [
    "+rtc_base/refcountedobject.h",
    "+rtc_base/scoped_ref_ptr.h",
  ],

  "audio_encoder\.h": [
    "+rtc_base/buffer.h",
    "+rtc_base/deprecation.h",
  ],

  "audio_encoder_factory\.h": [
    "+rtc_base/refcount.h",
  ],

  "audio_encoder_factory_template\.h": [
    "+rtc_base/refcountedobject.h",
    "+rtc_base/scoped_ref_ptr.h",
  ],

  "builtin_audio_decoder_factory\.h": [
    "+rtc_base/scoped_ref_ptr.h",
  ],

  "builtin_audio_encoder_factory\.h": [
    "+rtc_base/scoped_ref_ptr.h",
  ],

  "framedecryptorinterface\.h": [
    "+rtc_base/refcount.h",
  ],

  "frameencryptorinterface\.h": [
    "+rtc_base/refcount.h",
  ],

  "ortcfactoryinterface\.h": [
    "+rtc_base/network.h",
    "+rtc_base/scoped_ref_ptr.h",
    "+rtc_base/thread.h",
  ],

  "udptransportinterface\.h": [
    "+rtc_base/socketaddress.h",
  ],

  "rtcstatscollectorcallback\.h": [
    "+rtc_base/refcount.h",
    "+rtc_base/scoped_ref_ptr.h",
  ],

  "rtcstatsreport\.h": [
    "+rtc_base/refcount.h",
    "+rtc_base/refcountedobject.h",
    "+rtc_base/scoped_ref_ptr.h",
  ],

  "audioproc_float\.h": [
    "+modules/audio_processing/include/audio_processing.h",
  ],

  "fake_frame_decryptor\.h": [
    "+rtc_base/refcountedobject.h",
  ],

  "fake_frame_encryptor\.h": [
    "+rtc_base/refcountedobject.h",
  ],

  "fakeconstraints\.h": [
    "+rtc_base/stringencode.h",
  ],

  "mock.*\.h": [
    "+test/gmock.h",
  ],

  "simulated_network\.h": [
    "+rtc_base/criticalsection.h",
    "+rtc_base/random.h",
    "+rtc_base/thread_annotations.h",
  ],

  "test_dependency_factory\.h": [
    "+rtc_base/thread_checker.h",
  ],

  "videocodec_test_fixture\.h": [
    "+modules/video_coding/include/video_codec_interface.h"
  ],

  "i010_buffer\.h": [
    "+rtc_base/memory/aligned_malloc.h"
  ],

  "i420_buffer\.h": [
    "+rtc_base/memory/aligned_malloc.h",
  ],

  "video_frame_buffer\.h": [
    "+rtc_base/refcount.h",
    "+rtc_base/scoped_ref_ptr.h",
  ],

  "video_timing\.h": [
    "+rtc_base/numerics/safe_conversions.h",
  ],

  "video_encoder_config\.h": [
    "+rtc_base/refcount.h",
    "+rtc_base/scoped_ref_ptr.h",
  ],

  # .cc files in api/ should not be restricted in what they can #include,
  # so we re-add all the top-level directories here. (That's because .h
  # files leak their #includes to whoever's #including them, but .cc files
  # do not since no one #includes them.)
  ".*\.cc": [
    "+audio",
    "+call",
    "+common_audio",
    "+common_video",
    "+examples",
    "+logging",
    "+media",
    "+modules",
    "+p2p",
    "+pc",
    "+rtc_base",
    "+rtc_tools",
    "+sdk",
    "+stats",
    "+system_wrappers",
    "+test",
    "+tools",
    "+tools_webrtc",
    "+video",
    "+third_party",
  ],
}
